package cn.chencaiju.day10;

import java.io.File;
import java.io.IOException;

import org.junit.Test;

public class FileTest {
	@Test public void testFile() throws IOException {
		File f=new File("data/test.txt");
		if(f.exists()) {
			System.out.println("绝对路径:"+f.getAbsolutePath());
			System.out.println("文件名字:"+f.getName());
			System.out.println("相对路径:"+f.getPath());
			f.delete();
		}else {
			f.createNewFile();
			System.out.println("绝对路径:"+f.getAbsolutePath());
			System.out.println("文件名字:"+f.getName());
			System.out.println("相对路径:"+f.getPath());
		}
	}
	@Test public void testAbsolute() throws IOException {
		File f=new File("E:\\camp\\camp\\code\\data\\d1\\test.txt");
		if(f.exists()) {
			f.delete();
		}else {
			f.createNewFile();
		}
	}
}
